package io.renren.dao;

import io.renren.common.dao.BaseDao;
import io.renren.dto.AuxiliaryMateriDTO;
import io.renren.dto.SmallCanteenPurchaseDTO;
import io.renren.dto.StockOrderDTO;
import io.renren.entity.SmallCanteenPurchaseEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 小食堂采购表
 *
 * @author 翟文闯 619556390@QQ.com
 * @since 1.0.0 2019-11-22
 */
@Mapper
public interface SmallCanteenPurchaseDao extends BaseDao<SmallCanteenPurchaseEntity> {
    @Select(" select * from canteens_small_canteen_purchase  cs " +
            "LEFT JOIN canteens_small_canteen_purchasemx am  on am.small_canteen_purchase_id  =cs.small_canteen_purchase_id   "+
            " and am.supplier_id  =" +"'${id}'" +
            "WHERE cs.`status`>1    GROUP BY am.small_canteen_purchase_id  ORDER BY cs.create_date  desc " )
    List<SmallCanteenPurchaseDTO> selecSupplierSmallOrder(Long id);

    @Select("SELECT  COUNT(*) as pending   from  canteens_small_canteen_purchase where  `status` = '${status}' ${clerk_Id}  ${clerkId} ${canteen_Id} ")
    SmallCanteenPurchaseDTO getTotal(String clerk_Id,String clerkId, String canteen_Id , int status);
}